<template>
  <div>欢迎来到首页</div>
  <div>
    <el-button @click="logout()" type="primary">退出登录</el-button>
  </div>
</template>

<script setup>

import {get} from "../utils";
import {ElMessage} from "element-plus";
import router from "@/router";
import {useStore} from "../stores";

const store = useStore()

const logout = () =>{
  get('api/auth/logout',(message) => {
    ElMessage.success(message)
    store.auth.user = null
    router.push('/')
  })
}
</script>

<style scoped>

</style>